2005-06-15 Matthias Clasen <mclasen@redhat.com>
+ * gtk/gtksettings.c: Add two new settings,
+ gtk-cursor-theme-name and gtk-cursor-theme-size to
+ control the cursor theme.
+
+ * gdk/x11/gdkevents-x11.c: Add two new X settings,
+ Gtk/CursorThemeName and Gtk/CursorThemeSize, and map
+ these to the gtk settings.
+
+ * tests/testgtk.c (create_cursors): Add a cursor theme
+ testcase.
+
* gdk/x11/gdkwindow-x11.[hc]: Keep a reference to the
GdkCursor and add a private getter for it, so that we can
update the cursor when the cursor theme changes.
2005-06-15 Matthias Clasen <mclasen@redhat.com>
+ * gtk/gtksettings.c: Add two new settings,
+ gtk-cursor-theme-name and gtk-cursor-theme-size to
+ control the cursor theme.
+
+ * gdk/x11/gdkevents-x11.c: Add two new X settings,
+ Gtk/CursorThemeName and Gtk/CursorThemeSize, and map
+ these to the gtk settings.
+
+ * tests/testgtk.c (create_cursors): Add a cursor theme
+ testcase.
+
* gdk/x11/gdkwindow-x11.[hc]: Keep a reference to the
GdkCursor and add a private getter for it, so that we can
update the cursor when the cursor theme changes.
2005-06-15 Matthias Clasen <mclasen@redhat.com>
+ * gtk/gtksettings.c: Add two new settings,
+ gtk-cursor-theme-name and gtk-cursor-theme-size to
+ control the cursor theme.
+
+ * gdk/x11/gdkevents-x11.c: Add two new X settings,
+ Gtk/CursorThemeName and Gtk/CursorThemeSize, and map
+ these to the gtk settings.
+
+ * tests/testgtk.c (create_cursors): Add a cursor theme
+ testcase.
+
* gdk/x11/gdkwindow-x11.[hc]: Keep a reference to the
GdkCursor and add a private getter for it, so that we can
update the cursor when the cursor theme changes.
{ "Gtk/ButtonImages", "gtk-button-images" },
{ "Gtk/MenuImages", "gtk-menu-images" },
{ "Gtk/MenuBarAccel", "gtk-menu-bar-accel" },
+ { "Gtk/CursorThemeName", "gtk-cursor-theme-name" },
+ { "Gtk/CursorThemeSize", "gtk-cursor-theme-size" },
{ "Xft/Antialias", "gtk-xft-antialias" },
{ "Xft/Hinting", "gtk-xft-hinting" },
{ "Xft/HintStyle", "gtk-xft-hintstyle" },
#include "gtkprivate.h"
#include "gtkalias.h"
+#ifdef GDK_WINDOWING_X11
+#include "x11/gdkx.h"
+#endif
+
+#if 0
+#include <pango/pangoxft.h>
+#endif
+
typedef struct _GtkSettingsValuePrivate GtkSettingsValuePrivate;
typedef enum
GtkSettingsSource source;
};
-#if 0
-#include <pango/pangoxft.h>
-#include <gdk/x11/gdkx.h>
-#endif
-
enum {
PROP_0,
PROP_DOUBLE_CLICK_TIME,
PROP_XFT_HINTSTYLE,
PROP_XFT_RGBA,
PROP_XFT_DPI,
+ PROP_CURSOR_THEME_NAME,
+ PROP_CURSOR_THEME_SIZE,
#endif
PROP_ALTERNATIVE_BUTTON_ORDER
};
static void settings_update_double_click (GtkSettings *settings);
static void settings_update_modules (GtkSettings *settings);
+#ifdef GDK_WINDOWING_X11
+static void settings_update_cursor_theme (GtkSettings *settings);
+#endif
+
/* --- variables --- */
#if 0
static void
+
gtk_default_substitute (FcPattern *pattern,
gpointer data)
{
NULL);
g_assert (result == PROP_XFT_DPI);
+
+ result = settings_install_property_parser (class,
+ g_param_spec_string ("gtk-cursor-theme-name",
+ P_("Cursor theme name"),
+ P_("Name of the cursor theme to use"),
+ NULL,
+ GTK_PARAM_READWRITE),
+ NULL);
+ g_assert (result == PROP_CURSOR_THEME_NAME);
+
+ result = settings_install_property_parser (class,
+ g_param_spec_int ("gtk-cursor-theme-size",
+ P_("Cursor theme size"),
+ P_("Size to use for cursors"),
+ 0, 128, 24,
+ GTK_PARAM_READWRITE),
+ NULL);
+
+ g_assert (result == PROP_CURSOR_THEME_SIZE);
+
#endif /* GDK_WINDOWING_X11 */
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-alternative-button-order",
*/
gtk_rc_reset_styles (GTK_SETTINGS (object));
break;
+#endif
+#ifdef GDK_WINDOWING_X11
+ case PROP_CURSOR_THEME_NAME:
+ case PROP_CURSOR_THEME_SIZE:
+ settings_update_cursor_theme (settings);
+ break;
#endif /* GDK_WINDOWING_X11 */
}
}
g_free (modules);
}
+#ifdef GDK_WINDOWING_X11
+static void
+settings_update_cursor_theme (GtkSettings *settings)
+{
+ GdkDisplay *display = gdk_screen_get_display (settings->screen);
+ gchar *theme = NULL;
+ gint size = 0;
+
+ g_object_get (settings,
+ "gtk-cursor-theme-name", &theme,
+ "gtk-cursor-theme-size", &size,
+ NULL);
+
+ gdk_x11_display_set_cursor_theme (display, theme, size);
+}
+#endif
+
#define __GTK_SETTINGS_C__
#include "gtkaliasdef.c"
return FALSE;
}
+#ifdef GDK_WINDOWING_X11
+#include "x11/gdkx.h"
+
+static void
+change_cursor_theme (GtkWidget *widget,
+ gpointer data)
+{
+ const gchar *theme;
+ gint size;
+ GList *children;
+
+ children = gtk_container_get_children (GTK_CONTAINER (data));
+
+ theme = gtk_entry_get_text (GTK_ENTRY (children->next->data));
+ size = (gint) gtk_spin_button_get_value (GTK_SPIN_BUTTON (children->next->next->data));
+
+ g_list_free (children);
+
+ gdk_x11_display_set_cursor_theme (gtk_widget_get_display (widget),
+ theme, size);
+}
+#endif
+
+
static void
create_cursors (GtkWidget *widget)
{
GtkWidget *label;
GtkWidget *any;
GtkAdjustment *adj;
+ GtkWidget *entry;
+ GtkWidget *size;
if (!window)
{
"GtkWidget::visible", TRUE,
NULL);
+#ifdef GDK_WINDOWING_X11
hbox = gtk_hbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
+
+ label = gtk_label_new ("Cursor Theme : ");
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
+
+ entry = gtk_entry_new ();
+ gtk_entry_set_text (GTK_ENTRY (entry), "default");
+ gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, TRUE, 0);
+
+ size = gtk_spin_button_new_with_range (1.0, 64.0, 1.0);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (size), 24.0);
+ gtk_box_pack_start (GTK_BOX (hbox), size, TRUE, TRUE, 0);
+ g_signal_connect (entry, "changed",
+ G_CALLBACK (change_cursor_theme), hbox);
+ g_signal_connect (size, "changed",
+ G_CALLBACK (change_cursor_theme), hbox);
+#endif
+
+ hbox = gtk_hbox_new (FALSE, 0);
+ gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
+
label = gtk_label_new ("Cursor Value : ");
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);